#define _CRT_SECURE_NO_WARNINGS 1
#include "sort.h"
void bubble_sort(void* arr, size_t sz, size_t width, int (*pst)(const void*, const void*))
{
	size_t i = 0;
	size_t j = 0;
	for (i = 0; i < sz; i++)
	{
		for (j = 0; j < sz - 1 - i; j++)
		{
			if (pst((char*)arr + j*width,(char*)arr + (j + 1)*width) > 0)
			{
				Swp((char*)arr + j * width, (char*)arr + (j + 1) * width,width);
			}
		}
	}
}
void Swp(char* a1, char* a2, size_t width)
{
	for (int i = 1; i < width; i++)
	{
		char tmp = *a1;
		*a1 = *a2;
		*a2 = tmp;
		a1++;
		a2++;
	}
}

int pst1(const void* e1, const void* e2)
{
	return *(int*)e1 - *(int*)e2;
}



































